import request from '@/utils/request';

// 添加商品到购物车
export const addCartService = (data) => {
    console.log(data);
    return request.post('/cart/add', data, {
        headers: {
            'Content-Type': 'application/json'
        }
    });
}

// 获取购物车列表
export const getCartService = () => {
    return request.get('/cart/list');
}

// 更新购物车商品数量
export const updateCartService = (cartId, catQuantity) => {
    return request.put(`/cart/${cartId}`, catQuantity, {
        headers: {
            'Content-Type': 'application/json'
        }
    });
}

// 删除购物车商品
export const deleteCartService = (cartId) => {
    return request.delete(`/cart/delete/${cartId}`);
}
